Hi everyone, Filter hasLinks(LinkFilter value, string linkModName)
), but it does not work in my case. I have not been able to find a solution for counting all objects with incoming links.
pragma runLim,0
string fullModulePath = "path to current module"
string linkModuleName ="path to link module" // ?name or path to the link module?
Module m = read(fullModulePath, displayModule)
m = current()
Object o = null
Link inLink =null
filtering off
level 0
for o in m do
{
// some conditions
if (((isMember(o."*attributeName01*", "*foo*"))) and
(isMember(o."*attributeName02*", "*foo1*"))) then
{
//if has the object at least one incomming link from module A (goung through link module B) then accept and count this obeject otherwise decline this object
}
}
SystemAdmin - Wed May 12 15:52:40 EDT 2010 |
Re: How to count objects with inLinks in current module
Alexander,
Object o
Module m = current
link lnk
int lnk_count = 0
int obj_count = 0
int lnk_total_count = 0
for o in m do {
lnk_count = 0
for lnk in o <- "*" do { // cycles through all incoming links
lnk_count++
}
if (lnk_count > 0) obj_count++
lnk_total_count = lnk_total_count + lnk_count
}
print "Number of Objects with Links:\t" obj_count "\n"
print "Total Number of Links:\t lnk_total_count "\n"
|
Re: How to count objects with inLinks in current module Ben_Sharples - Thu May 13 04:53:15 EDT 2010
Alexander,
Object o
Module m = current
link lnk
int lnk_count = 0
int obj_count = 0
int lnk_total_count = 0
for o in m do {
lnk_count = 0
for lnk in o <- "*" do { // cycles through all incoming links
lnk_count++
}
if (lnk_count > 0) obj_count++
lnk_total_count = lnk_total_count + lnk_count
}
print "Number of Objects with Links:\t" obj_count "\n"
print "Total Number of Links:\t lnk_total_count "\n"
Hi,
...
Object o
Module m = current
String NameLinkModule ="/../../name"
int obj_count = 0
bool findInLink(Object TargetObject,string linkModuleName)
{
LinkRef inLink
bool found = false
int lnk_count = 0
for inLink in (targetObject)<-linkModuleName do // cycles through all incoming links from source module
{
lnk_count++
if (lnk_count > 0)
{
found = true
break
}
}
if (!found)
{
// Couldn't find the target object.
return false
}
} // findInLink
for o in m do
{
if (findInLink(o,linkModuleName))
{
obj_count++
}
}
print "Number of Objects with Links:\t" obj_count "\n"
|
Re: How to count objects with inLinks in current module Issues to consider potentially in the future - multiple source modules of the incoming links (using the same link module) - In this case you would want to test against the source module name |
Re: How to count objects with inLinks in current module
Hi,
for inLink in (targetObject)<-linkModuleName do
{
found = true
break
}
regards
|
Re: How to count objects with inLinks in current module Ben_Sharples - Thu May 13 04:53:15 EDT 2010
Alexander,
Object o
Module m = current
link lnk
int lnk_count = 0
int obj_count = 0
int lnk_total_count = 0
for o in m do {
lnk_count = 0
for lnk in o <- "*" do { // cycles through all incoming links
lnk_count++
}
if (lnk_count > 0) obj_count++
lnk_total_count = lnk_total_count + lnk_count
}
print "Number of Objects with Links:\t" obj_count "\n"
print "Total Number of Links:\t lnk_total_count "\n"
-E- DXL: <Line:3> incorrect arguments for function (link) -E- DXL: <Line:3> undeclared variable (lnk) -E- DXL: <Line:12> incorrect arguments for (do) -E- DXL: <Line:22> badly formed token (") -E- DXL: <Line:22> incorrect arguments for (\) -E- DXL: <Line:22> undeclared variable (n) -I- DXL: all done with 6 errors and 0 warnings |
Re: How to count objects with inLinks in current module Gedinfo - Mon Jun 28 13:30:46 EDT 2010 |